

import java.util.List;

import junit.framework.TestCase;


public class GraphAlgorithmsTest extends TestCase{
	
	
	public void testQueue()
	{
		List<TestVertex> vertices = TestVertex.buildTestGraph();
		TestVertex a = vertices.get(0);
		TestVertex c = vertices.get(4);
		Path<TestVertex> out = GraphAlgorithms.search(a, c, new QueueDelegator<TestVertex>());
		System.out.println(out);
		List<Path<TestVertex>> outTrav = GraphAlgorithms.traverse(a, new QueueDelegator<TestVertex>());
		System.out.println(outTrav);
	
	}
	public void testPQ()
	{
		List<TestVertex> vertices = TestVertex.buildTestGraph();
		TestVertex a = vertices.get(0);
		TestVertex c = vertices.get(2);
		Path<TestVertex> out = GraphAlgorithms.search(a, c, new PQDelegator<TestVertex>(new DijkstraComp<TestVertex>()));
		System.out.println(out);
		List<Path<TestVertex>> outTrav = GraphAlgorithms.traverse(a, new PQDelegator<TestVertex>(new DijkstraComp<TestVertex>()));
		System.out.println(outTrav);
		
		
	}
	
	public void testPQPrim()
	{
		List<TestVertex> vertices = TestVertex.buildTestGraph();
		TestVertex a = vertices.get(0);
		TestVertex c = vertices.get(2);
		Path<TestVertex> out = GraphAlgorithms.search(a, c, new PQDelegator<TestVertex>(new PrimComp<TestVertex>()));
		System.out.println(out);
		List<Path<TestVertex>> outTrav = GraphAlgorithms.traverse(a, new PQDelegator<TestVertex>(new PrimComp<TestVertex>()));
		System.out.println(outTrav);
	}
	
	@SuppressWarnings("rawtypes")
	public void testStack()
	{
		List<TestVertex> vertices = TestVertex.buildTestGraph();
		TestVertex a = vertices.get(0);
		TestVertex c = vertices.get(4);
		@SuppressWarnings("unchecked")
		Path<TestVertex> out = GraphAlgorithms.search(a, c, new StackDelegator());
		System.out.println(out);
	}
	
	public void testOther()
	{
		List<MyVertex> vertices = MyVertex.buildFromFile("test.txt");
		MyVertex a = vertices.get(0);
		MyVertex c = vertices.get(10);
		Path<MyVertex> out = GraphAlgorithms.search(a, c, new PQDelegator<MyVertex>(new DijkstraComp<MyVertex>()));
		System.out.println(out);
		@SuppressWarnings({ "unchecked", "rawtypes" })
		List<Path<MyVertex>> outTrav = GraphAlgorithms.traverse(a, new StackDelegator());
		System.out.println(outTrav);
	}

}
